package lzyc.pointsManagement.business.config;

import lombok.Getter;

@Getter
public enum ApprovalStatus {
    APPROVED("0", "已通过"),
    PENDING("1", "待审核"),
    REJECTED("2", "未通过");

    private final String code;
    private final String value;

    ApprovalStatus(String code, String value) {
        this.code = code;
        this.value = value;
    }

    // 添加一个静态方法，根据code返回对应的枚举值
    public static ApprovalStatus fromCode(String code) {
        for (ApprovalStatus status : ApprovalStatus.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("No enum constant with code " + code);
    }

}
